package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the COMPLAIN_TYPE database table.
 * 
 */
@Entity
@Table(name="COMPLAIN_TYPE")
@NamedQuery(name="ComplainType.findAll", query="SELECT c FROM ComplainType c")
public class ComplainType implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="COMPLAIN_TYPE_COMPLAINID_GENERATOR", sequenceName="SEQ_58")   
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="COMPLAIN_TYPE_COMPLAINID_GENERATOR")
	@Column(name="COMPLAIN_ID")
	private long complainId;

	@Column(name="COMPLAIN_CONTAIN")
	private String complainContain;

	//bi-directional many-to-one association to Complain
	@OneToMany(mappedBy="complainType")
	private List<Complain> complains;

	public ComplainType() {
	}

	public ComplainType(long complainId, String complainContain) { 
		super();
		this.complainId = complainId;
		this.complainContain = complainContain;
	}

	public long getComplainId() {
		return this.complainId;
	}

	public void setComplainId(long complainId) {
		this.complainId = complainId;
	}

	public String getComplainContain() {
		return this.complainContain;
	}

	public void setComplainContain(String complainContain) {
		this.complainContain = complainContain;
	}

	public List<Complain> getComplains() {
		return this.complains;
	}

	public void setComplains(List<Complain> complains) {
		this.complains = complains;
	}

	public Complain addComplain(Complain complain) {
		getComplains().add(complain);
		complain.setComplainType(this);

		return complain;
	}

	public Complain removeComplain(Complain complain) {
		getComplains().remove(complain);
		complain.setComplainType(null);

		return complain;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "ComplainType [complainId=" + complainId + ", complainContain=" + complainContain + "]";
	}

}